var result = document.querySelectorAll('[data-event-id=""]');
var widget_exists = document.getElementsByClassName("ewidget-header").length;
if(result.length > 0){
var newElement = document.createElement('div');
newElement.innerHTML = 'non-existing object(function(window, document, version, callback) { var j, d; var loaded = false; if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { var script = document.createElement(\"script\"); script.type = \"text/javascript\"; script.src = \"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"; script.onload = script.onreadystatechange = function() { if (!loaded && (!(d = this.readyState) || d == \"loaded\" || d == \"complete\")) { callback((j = window.jQuery).noConflict(1), loaded = true); j(script).remove(); } }; document.documentElement.childNodes[0].appendChild(script); if (document.getElementById(\"modalDescription\")) { var modalDescription = document.getElementById(\"modalDescription\"); var modalDescriptionShowActions = document.getElementsByClassName(\"event__modal-action\"); var modalDescriptionCloseAction = document.getElementById(\"modalDescriptionCloseAction\"); var modalDescriptionTextEl = document.getElementById(\"modalDescriptionTextEl\"); Array.from(modalDescriptionShowActions).forEach(function(action) { action.addEventListener(\"click\", function(event) { modalDescriptionTextEl.innerHTML = event.target.dataset.description; modalDescription.style.display = \"block\"; }); }); modalDescriptionCloseAction.onclick = function() { modalDescription.style.display = \"none\"; modalDescriptionTextEl.innerHTML = \"\"; }; window.onclick = function(event) { if (event.target == modalDescription) { modalDescription.style.display = \"none\"; modalDescriptionTextEl.innerHTML = \"\"; } }; } var elements = document.getElementsByClassName(\"ticketQuantitySelector\"); var recalculateTotal = function(event) { var final_price = 0; var ticket_categories = document.getElementsByClassName(\"ticketQuantitySelector\"); for (var i = 0; i < ticket_categories.length; i++) { var select_parent_category = ticket_categories[i].parentNode.parentNode; var amount_fee = select_parent_category.querySelector(\'.amount-fee\') ? parseFloat(select_parent_category.querySelector(\'.amount-fee\').innerText.replace(\',\', \'.\')) : 0; var amount = select_parent_category.querySelector(\'.amount\') ? parseFloat(select_parent_category.querySelector(\'.amount\').innerText.replace(\',\', \'.\')) : 0; var selected_quantity = select_parent_category.querySelector(\'.ticketQuantitySelector\') ? select_parent_category.querySelector(\'.ticketQuantitySelector\').value : 0; final_price += (selected_quantity * amount_fee) + (selected_quantity * amount); } document.querySelector(\'.total-payment-amount\').innerText = final_price; document.querySelector(\'.total-payment-amount-eur\').innerText = (Number(final_price) * 7.53450).toFixed(2); }; for (var i = 0; i < elements.length; i++) { elements[i].addEventListener(\'change\', recalculateTotal, false); } }})(window, document, \"1.3\", function($, jquery_loaded) {});';
result[0].parentNode.insertBefore(newElement, result[0]);
}else{ // legacy method
document.write('non-existing object(function(window, document, version, callback) { var j, d; var loaded = false; if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { var script = document.createElement(\"script\"); script.type = \"text/javascript\"; script.src = \"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"; script.onload = script.onreadystatechange = function() { if (!loaded && (!(d = this.readyState) || d == \"loaded\" || d == \"complete\")) { callback((j = window.jQuery).noConflict(1), loaded = true); j(script).remove(); } }; document.documentElement.childNodes[0].appendChild(script); if (document.getElementById(\"modalDescription\")) { var modalDescription = document.getElementById(\"modalDescription\"); var modalDescriptionShowActions = document.getElementsByClassName(\"event__modal-action\"); var modalDescriptionCloseAction = document.getElementById(\"modalDescriptionCloseAction\"); var modalDescriptionTextEl = document.getElementById(\"modalDescriptionTextEl\"); Array.from(modalDescriptionShowActions).forEach(function(action) { action.addEventListener(\"click\", function(event) { modalDescriptionTextEl.innerHTML = event.target.dataset.description; modalDescription.style.display = \"block\"; }); }); modalDescriptionCloseAction.onclick = function() { modalDescription.style.display = \"none\"; modalDescriptionTextEl.innerHTML = \"\"; }; window.onclick = function(event) { if (event.target == modalDescription) { modalDescription.style.display = \"none\"; modalDescriptionTextEl.innerHTML = \"\"; } }; } var elements = document.getElementsByClassName(\"ticketQuantitySelector\"); var recalculateTotal = function(event) { var final_price = 0; var ticket_categories = document.getElementsByClassName(\"ticketQuantitySelector\"); for (var i = 0; i < ticket_categories.length; i++) { var select_parent_category = ticket_categories[i].parentNode.parentNode; var amount_fee = select_parent_category.querySelector(\'.amount-fee\') ? parseFloat(select_parent_category.querySelector(\'.amount-fee\').innerText.replace(\',\', \'.\')) : 0; var amount = select_parent_category.querySelector(\'.amount\') ? parseFloat(select_parent_category.querySelector(\'.amount\').innerText.replace(\',\', \'.\')) : 0; var selected_quantity = select_parent_category.querySelector(\'.ticketQuantitySelector\') ? select_parent_category.querySelector(\'.ticketQuantitySelector\').value : 0; final_price += (selected_quantity * amount_fee) + (selected_quantity * amount); } document.querySelector(\'.total-payment-amount\').innerText = final_price; document.querySelector(\'.total-payment-amount-eur\').innerText = (Number(final_price) * 7.53450).toFixed(2); }; for (var i = 0; i < elements.length; i++) { elements[i].addEventListener(\'change\', recalculateTotal, false); } }})(window, document, \"1.3\", function($, jquery_loaded) {});');
}